<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<script>
// 遍历所有花色与点数
for (var i in types) {
for (var j in points) {
cards.push(types[i] + points[j])
}
}
// 显示
console.log(cards);

// 洗牌
// 遍历 cards 数组
for (var i = 0, len = cards.length; i < len; i++) {
// 生成一个随机的数组下标(0~53)
var index = Math.floor(Math.random() * len);
// 将当前遍历到的元素与随机下标处的元素交换位置
var tmp = cards[i];
cards[i] = cards[index];
cards[index] = tmp;
}

/*
cards.sort(function(){
return Math.random() - 0.5;
});*/

console.log(cards);

// 发牌
var first = cards.splice(0, 17);
var second = cards.splice(0, 17);
var third = cards.splice(0, 17);

console.log(first)
console.log(second)
console.log(third)
console.log(cards)
</script>
</body>
</html>